﻿<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="NCC_SOP.test" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
.label
{
    width:200px;
}

.option
{
    width:300px;
}
    
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2 style="color:red">Cancer Statistics Review</h2>

    <div>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <div class="gridPositioning">
        <div style="max-width: 995px; padding-right: 10px;">
            <fieldset>
            <legend>Searching Criteria:</legend>
            <div style="float: left; width: 100%;">
                <!-- RadGrid implementation with basic paging -->
                <telerik:RadGrid ID="RadGrid1" runat="server" width="100%" AllowPaging="True" AllowSorting="True"
                    Skin="WebBlue" DataSourceID="sqlDatasource1" AllowFilteringByColumn="True"
                    OnItemCommand="RadGrid1_ItemCommand" CellSpacing="0" GridLines="None">
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="Bottom"></PagerStyle>               
                
                        <MasterTableView AutoGenerateColumns="false" AllowFilteringByColumn="True" ShowFooter="True">
                    
                        <Columns>
                            <telerik:GridBoundColumn DataField="rptName" HeaderText="Report Name" UniqueName="rptName"
                                AutoPostBackOnFilter="true" ShowFilterIcon="true">
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxTitle" DataSourceID="sqlDatasource1" DataTextField="rptName"
                                        DataValueField="rptName" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("rptName").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
                                    <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                    </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                        <script type="text/javascript">
                                        function TitleIndexChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("rptName", args.get_item().get_value(), "EqualTo");
                                        }
                                        </script>
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            
                            <telerik:GridBoundColumn FilterControlWidth="80px" DataField="datasource" HeaderText="Data Source" UniqueName="datasource"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxDS" DataSourceID="SqlDataSource3" DataTextField="datasource"
                                        DataValueField="datasource" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("datasource").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="DSIndexChanged">
                                    <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                    </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                        <script type="text/javascript">
                                            function DSIndexChanged(sender, args) {
                                                var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                tableView.filter("datasource", args.get_item().get_value(), "EqualTo");
                                            }
                                        </script>
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>                  
                            
                            <telerik:GridBoundColumn FilterControlWidth="120px" DataField="rptDescription" HeaderText="Description" UniqueName="rptDescription"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn FilterControlWidth="80px" DataField="status" HeaderText="Status" UniqueName="status"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                            </telerik:GridBoundColumn>
                            
                            <telerik:GridDateTimeColumn FilterControlWidth="95px" DataField="updatedOn" HeaderText="Updated On" UniqueName="updatedOn"
                                AutoPostBackOnFilter="true" SortExpression="OrderDate" DataFormatString="{0:MM/dd/yyyy}" ShowFilterIcon="false">
                            </telerik:GridDateTimeColumn>

                            <telerik:GridTemplateColumn 
                                UniqueName="edit" 
                                AllowFiltering="false" 
                                HeaderText="VIEW" HeaderStyle-Width="50px">
                    
                               <ItemTemplate>
                                     <%#Eval("isRPT").ToString().Equals("0") ?
                                                                     "<a href='pdfViewer.aspx?rptID=" + Eval("rptID").ToString().Trim() + "'><img src='images/file_view.jpg' width='20px' height='20px' alt='' /></a>" :
                                                                     "<a href='" + Eval("fileName").ToString().Trim() + "?rptID=" + Eval("rptID").ToString().Trim() + "'><img src='images/file_view.jpg' width='20px' height='20px' alt='' /><img src='images/Dynamic_Icon.png' width='20px' height='20px' alt='' /></a>"
                                     %>
                                </ItemTemplate>


                            </telerik:GridTemplateColumn>

                        </Columns>
                        </MasterTableView>
                        <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                            <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
                        </ClientSettings>
                </telerik:RadGrid>
            </div>
            </fieldset>
        </div>
        </div>

        <!-- Data Source Implementation -->
        
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MembershipString %>"
            SelectCommand="select DISTINCT tableID as rptID, [fileName], tableName as rptName, tableDescription AS rptDescription, datasource, dataType, data_filter1, updatedOn, status, isRPT from metaDisplayView">
        </asp:SqlDataSource>
        
        <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:MembershipString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT DISTINCT TableName FROM MetadataTables"
        runat="server">
        </asp:SqlDataSource>

        <asp:SqlDataSource ID="SqlDataSource3"  runat="server" ConnectionString="<%$ ConnectionStrings:MembershipString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="select distinct dataSource from metaDisplayView">
        </asp:SqlDataSource>
    </div>
</asp:Content>
